<?php
require('../config.php');

		$user_id=$_REQUEST['user_id'];
		$start=0;
		$num=10;
		if(isset($_REQUEST['start'])) $start=$_REQUEST['start'];
		if(isset($_REQUEST['num'])) $num=$_REQUEST['num'];
		//$sql="select m.id,m.shopid,m.shopname,m.shopqishu,m.gonumber from `".$oto."_member_go_record` as m where `uid`='{$user_id}' order by id DESC limit $start,$num";
		$sql="select a.id,a.shopid,a.shopname,a.shopqishu,a.gonumber,a.huode,b.title,b.q_end_time,b.thumb,b.money,b.sid,b.qishu from `".$oto."_member_go_record` a left join `".$oto."_shoplist` b on a.shopid=b.id where b.q_uid='{$user_id}' and a.huode!=0  and b.q_showtime='N' order by a.time desc limit $start,$num";
		$result=$db->query($sql);
		while($row=$result->fetch_assoc()){
			$member_go_record[]=$row;//将取得的所有数据赋值给person_info数组
		}
		if(isset($member_go_record))
		{
			for($i=0;$i<count($member_go_record);$i++)
			{
				$xsd=explode('.',$member_go_record[$i]['q_end_time']);
				if(count($xsd)>1) $xsd=$xsd[1];
				else $xsd=$xsd[0];
				$member_go_record[$i]['jx_time']=date('Y-m-d H:i:s',$member_go_record[$i]['q_end_time']).'.'.$xsd;
				//获取期数
				$sid=$member_go_record[$i]['sid'];
				$sql="select s.qishu from `".$oto."_shoplist` as s where sid='{$sid}' order by qishu desc limit 1";
				$result=$db->query($sql);
				while($row=$result->fetch_assoc()){
					$qishu_info=$row;
				}
				if(isset($qishu_info)) $member_go_record[$i]['max_qishu']=$qishu_info['qishu'];
				else $member_go_record[$i]['max_qishu']="";
			}
		}
		if(isset($member_go_record)) echo json_encode($member_go_record);
		else echo '[]';

?>